home *** CD-ROM | disk | FTP | other *** search
/ Champak 138 / Volume 138 Aug 19 2011 - Damaged.iso / Games / shadez.swf / scripts / Local / Game / Thing / CWeaponGunApache.as < prev    next >
Encoding:
Text File  |  2011-08-19  |  3.0 KB  |  104 lines

  1. package Local.Game.Thing
  2. {
  3.    import Local.Game.World.*;
  4.    import Local.Game.World.Map.*;
  5.    import Local.Game.World.Map.Cell.*;
  6.    import Local.Math.*;
  7.    import STC9.System.*;
  8.    import flash.display.*;
  9.    import flash.events.*;
  10.    import flash.geom.*;
  11.    
  12.    public class CWeaponGunApache extends CWeapon
  13.    {
  14.       
  15.       private static var mSoundIndex:* = 0;
  16.       
  17.       public static var _Upgrades:Array = [{
  18.          "mName":"",
  19.          "mAmmo":INFINATEAMMO,
  20.          "mAutoFire":true,
  21.          "mFireRate":1,
  22.          "mDamage":10,
  23.          "mRange":700
  24.       }];
  25.        
  26.       
  27.       public function CWeaponGunApache()
  28.       {
  29.          super();
  30.          mUpgrade = 0;
  31.          mType = "gunapache";
  32.          Process = Process_Normal;
  33.          AddAnimation("stand",Apache_MainGun,"AddSprite_Black");
  34.          AddSound("fire_0",Apache_Shot_1);
  35.          AddSound("fire_1",Apache_Shot_2);
  36.          AddSound("fire_2",Apache_Shot_3);
  37.          AddSound("fire_3",Apache_Shot_4);
  38.       }
  39.       
  40.       override public function Fire() : void
  41.       {
  42.          var _loc1_:CShot = null;
  43.          AddThing(_loc1_ = new CShotBullet(GetShotPosition(),GetShotDelta(),100 + Math.random() * 80,mCurrentTarget));
  44.          IncrementFired();
  45.          if(mParent.mDrawn)
  46.          {
  47.             AddThing(new CEffectMuzzleFlash(MuzzleFlash_M16,_loc1_.mPosition.Clone(),_loc1_.mDelta));
  48.          }
  49.          var _loc2_:*;
  50.          var _loc3_:* = Number((_loc2_ = ┬º┬ºfindproperty(mSoundIndex)).mSoundIndex) + 1;
  51.          ┬º┬ºpush(┬º┬ºfindproperty(PlaySound));
  52.          ┬º┬ºpush("fire_");
  53.          ┬º┬ºpush(Number((_loc2_ = ┬º┬ºfindproperty(mSoundIndex)).mSoundIndex));
  54.          if(true)
  55.          {
  56.             _loc2_.mSoundIndex = _loc3_;
  57.          }
  58.          if(true)
  59.          {
  60.             ┬º┬ºpush(┬º┬ºpop() % 4);
  61.          }
  62.          ┬º┬ºpop().PlaySound(┬º┬ºpop() + ┬º┬ºpop());
  63.       }
  64.       
  65.       public function GetShotDelta() : CPosition
  66.       {
  67.          return CPosition.SUBTRACT(mCurrentTarget.mCollide.mMid,mPosition);
  68.       }
  69.       
  70.       public function GetShotPosition() : CPosition
  71.       {
  72.          var _loc1_:Point = null;
  73.          _loc1_ = mAngle.mMatrix.transformPoint(mSprite.mObjects["shot"].mPosition);
  74.          return new CPosition(_loc1_.x + mPosition.x,_loc1_.y + mPosition.y);
  75.       }
  76.       
  77.       override public function get mWeaponName() : String
  78.       {
  79.          return "minigun";
  80.       }
  81.       
  82.       override public function Draw() : void
  83.       {
  84.          super.Draw();
  85.          DrawSprite(GetOrientationMatrix());
  86.       }
  87.       
  88.       public function Process_Normal() : void
  89.       {
  90.          if(mCurrentTarget)
  91.          {
  92.             mAngle.mAngleRAD = CPosition.SUBTRACT(mCurrentTarget.mCollide.mMid,mPosition).mAngleRAD;
  93.          }
  94.          WeaponUpdate();
  95.          Process_Children();
  96.       }
  97.       
  98.       override public function get mUpgrades() : Array
  99.       {
  100.          return _Upgrades;
  101.       }
  102.    }
  103. }
  104.